/*
 * sensors.h
 *
 * Created: 14/07/2011 21:21:34
 *  Author: guy
 */ 

#pragma once



#define SEN_GX 0
#define SEN_GY 1
#define SEN_GZ 2
#define SEN_AX 3
#define SEN_AY 4
#define SEN_AZ 5
#define SEN_MX 6
#define SEN_MY 7
#define SEN_MZ 8
#define SEN_B  9

#define cR 0 // i.e. roll around teh x axis +ve is right wing down
#define cP 1 // pitch = rotation around teh y axis - +ve is pitch up
#define cY 2 // yaw around teh z axis - +ve is x axis moving cw towards y


#define NPOINT_AVERAGE           2   //N point average definition (shift definition) = 4  (1<<2)
// These two Should be the same as but make sure that NPOINT_FILTER_ACCURACY*NPOINT_AVERAGE < 32767


//L3G4200D
#define L3G4200D_ADDR			0x69
#define L3G4200D_ID				0xD3
#define L3G4200D_MDPS_PER_DIGIT 70.0f   // this value from datasheet - for 2000 DPS  0.007 deg/sec/digit
#define L3G4200D_DPS_PER_DIGIT  (L3G4200D_MDPS_PER_DIGIT/1000.0f)

//MPL3115A2
#define MPL3115A2_ADDR          0x60

//ACCEL - LSM303DLHS
#define LSM303DLHC_ACCEL_ADDR   0x19

//MAG   - LSM303DLHS
#define LSM303DLHC_MAG_ADDR     0x1E




void	populateSensorData();
void	calibrateGyro();
void    calibrateCompassAccel();
uint8_t lsm303dlhc_init();
uint8_t l3g4200d_init();

float l3g4200dToRPS(int16_t x);

extern int16_t sensor_data_int[10];

